from celery import Celery


import os
if not os.environ.get('DJANGO_SETTINGS_MODULE'):
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings.dev")

celery_app = Celery('celery_tasks')
celery_app.config_from_object('celery_tasks.config')
celery_app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email', 'celery_tasks.html'])


# from celery import Celery
#
# # 设置Django运行所依赖的环境变量
# import os
# if not os.environ.get('DJANGO_SETTINGS_MODULE'):
#     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings.dev")
#
# # 创建Celery类实例对象
# celery_app = Celery('celery_tasks')
#
# # 加载配置
# celery_app.config_from_object('celery_tasks.config')
#
# # celery worker启动时自动发现任务函数
# celery_app.autodiscover_tasks(['celery_tasks.sms', 'celery_tasks.email'])
